const mongoose=require("mongoose");
var BookSchema=new mongoose.Schema({
	bname:String,price:Number
});
mongoose.model("Book",BookSchema);

var Book=mongoose.model("Book");

var book=new Book({bname:"book2",price:43.45});



var db=mongoose.connect("mongodb://127.0.0.1/mydb",function(err){
	if(!err){
	

		// book.save(function(err,bk){
		// 	console.log(bk);
		// 	db.disconnect();
		// });

		// Book.findOne({_id:'58c2622c96bede0eb165d382'},(err,bs)=>{
		// 	console.log(bs);
		// 	db.disconnect();
		// })

		// Book.remove({_id:'58c2622c96bede0eb165d382'},(err)=>{
		// 	if(!err) console.log("delete suc!!!")
		// 		db.disconnect();
		// });

		Book.find({},(err,bs)=>{
			console.log(bs);
			db.disconnect();
		})


		// Book.findByIdAndUpdate('58c26250c5fd040eb3fc2dda',
		// {bname:'book3',price:123},(err,ou)=>{
		// 	db.disconnect();
		// }
		// );
		
		







	}
});



